#ifndef CAENDISCRIMINATOR_H
#define CAENDISCRIMINATOR_H

#include <stdint.h>

class CaenDiscriminator {

  protected:
    uint8_t outputWidth[2];
    uint8_t deadTime[2];
    uint8_t threshold[16];
    uint8_t majorityThreshold;
    bool    channelEnabled[16];
    
  public:
    virtual ~CaenDiscriminator() {}; 
    
    virtual void SetThreshold(int channel, uint8_t value) = 0;
    virtual uint8_t GetThreshold(int channel) { return threshold[channel]; };
    
    virtual void SetInhibitPattern(uint16_t pattern) = 0;
    virtual void EnableChannel(int channel);
    virtual void DisableChannel(int channel);
    virtual bool ChannelEnabled(int channel) { return channelEnabled[channel]; }; 
    
    virtual void SetOutputWidth(int chrange, uint8_t value) = 0;
    virtual uint8_t GetOutputWidth(int chrange) { return outputWidth[chrange]; };
    
    virtual void SetDeadTime(int chrange, uint8_t value) = 0;
    virtual uint8_t GetDeadTime(int chrange) { return deadTime[chrange]; };
    
    virtual void SetMajorityThreshold(uint8_t) = 0;
    virtual uint8_t GetMajorityThreshold() { return majorityThreshold; };
    
    virtual void GenTestPulse() = 0;
    int GetNChannels() { return 16; };
};

#endif
